<extend name="public:base"/>

<block name="main">
    <div class="slide_main fr">
        <h1 class="frame_title mb10">投资明细</h1>

        <div class="frame_slide" id="rotate">
            <include file="invested:menu"/>
        </div>
        <div class="frame_slide_con">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableBlue">
                <tbody>
                <tr>
                    <th class="first">项目名称</th>

                    <th>购买总金额</th>
                    <th>预期利息</th>

                    <th>状态</th>
                    <th>投资时间</th>
                    <th>到期时间</th>
                    <!--<th>状态</th>-->

                    <th>到期出售</th>
                </tr>

                <notempty name="list">
                    <volist name="list" id="v">
                        <tr class="tc">

                            <td class="first">
                                <a href="{:url('index/invest/detail',['id'=>$v['borrow_id']])}" target="_blank">
                                    {$v.borrow_name}</a>
                            </td>

                            <td>{$v.invest_capital}</td>
                            <td>{$v.invest_interest}</td>

                            <td>{$v.status_name}</td>
                            <td>{$v.create_time}</td>
                            <td>{$v.deadline}</td>


                            <td>
                                <!--<a href="">合同</a>-->
                                <!--<a data-href="{:url('sale', ['id'=>$v.id])}" data-id="{$v.id}" class="sale">出售</a>-->

                                    <a data-id="{$v.id}" data-href="{:url('sale', ['id'=>$v.id])}" class="sale" style="cursor: pointer">出售</a>



                            <td/>
                        </tr>
                    </volist>
                    <else/>
                    <td colspan="7" class="text-center"> 暂无内容</td>
                </notempty>

                </tbody>
            </table>

            <div class="page">{$page|default=''}</div>

        </div>
    </div>
</block>


<block name="js">

    <script type="text/javascript">

        $(function () {

            //确定出售
            $('.sale').on('click', function () {

                var _this = $(this);
                var id = _this.attr('data-id');
                if (id.length < 1) {
                    alert('参数不可为空');
                    return false;
                }
                var href = _this.attr('data-href');

                $.post(href, {id: id}, function (data) {

                    if (data.code) {
                        alert(data.msg);
                        window.location.href = data.url;
                        return false;
                    } else {
                        alert(data.msg);
                        return false;
                    }
                }, 'json');
                return false;
            });

        });

        // function cancel_debt(id) {
        //     // 取消询问框
        //     layer.confirm('是否取消转让？', {
        //         btn: ['确定', '取消'] //按钮
        //     }, function (index) {
        //         layer.close(index);
        //         $.post("{:url('uc/debt/cancel')}", {id: id}, function (data) {
        //             if (data.code == 1) {
        //                 function toLink() {
        //                     window.location.href = "{:url('uc/invest/index')}";
        //                 }
        //
        //                 layer.alert(data.msg, {icon: 1}, function (ins) {
        //                     toLink();
        //                     layer.close(ins);
        //                     return false;
        //                 });
        //                 setTimeout(toLink, 1500);
        //                 return false;
        //             } else {
        //                 layer.alert(data.msg, {icon: 2});
        //                 return false;
        //             }
        //         });
        //     }, function () {
        //         layer.closeAll();
        //     });
        // }
    </script>
</block>